We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4064826 commit a064075Copy full SHA for a064075
kitsune/questions/utils.py
@@ -153,14 +153,21 @@ def flag_question(
153
reason: str = FlaggedObject.REASON_CONTENT_MODERATION,
154
) -> None:
155
content_type = ContentType.objects.get_for_model(question)
156
- FlaggedObject.objects.create(
+ flagged_object, created = FlaggedObject.objects.get_or_create(
157
content_type=content_type,
158
object_id=question.id,
159
creator=by_user,
160
- status=status,
161
- reason=reason,
162
- notes=notes,
+ defaults=dict(
+ reason=reason,
+ status=status,
163
+ notes=notes,
164
+ ),
165
)
166
+ if not created:
167
+ flagged_object.reason = reason
168
+ flagged_object.status = status
169
+ flagged_object.notes = notes
170
+ flagged_object.save()
171
172
173
def process_classification_result(
0 commit comments